/**
 * 
 */
package com.dianba.supply.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dianba.commons.exception.lang.AbstractApiController;
import com.dianba.supply.demo.mapper.CommonAddressMapper;
import com.dianba.supply.demo.service.TestAddressService;

/**
 *
 *
 * @author zhoucong
 * @date 2016年4月27日 上午9:11:26
 */
@Controller
@RequestMapping(value = "/testAddress")
public class TestAddressController extends AbstractApiController {
	@Autowired
	private TestAddressService addressService;
	@Autowired
	private CommonAddressMapper addressMapper;

	@RequestMapping(value = "/getMaxIdFromUserId")
	@ResponseBody
	public void getMaxIdFromUserId() {
		Integer id = mustInt("id");
		Long value = this.addressService.getMaxIdFromUserId(id);
		addResponseBody(value);
	}

	@RequestMapping(value = "/updateAddressSetDefaultByUserId")
	@ResponseBody
	public void updateAddressSetDefaultByUserId() {
		Integer userId = mustInt("userId");
		this.addressService.updateAddressSetDefaultByUserId(userId);
	}

	@RequestMapping(value = "/updateAddressSetDefaultByUserId2")
	@ResponseBody
	public void updateAddressSetDefaultByUserId2() {
		Integer userId = mustInt("userId");
		this.addressMapper.updateAddressSetDefaultByUserId(userId);
	}
}
